<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>访客记录</title>
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/motai3.css">
	<style>
		.search_img {
			position: absolute;
			right: 3%;
		}

		.modal-data5,
		.modal-content5 {
			min-height: unset;
			height: unset;
		}

		.modal-content5 .layui-input {
			width: 50%;
			margin: 0 auto;
		}

		.long-background-img {
			width: 120px;
			height: 35px;
			margin-left: 10px;
			background: url("../image/enter_longer.png") no-repeat center center !important;
		}

		.photo {
			width: 45px;
			height: 45px;
		}

		.other {
			height: 33px;
			max-width: 120px;
			width: 15vw;
			height: 35px;
			padding-left: 20px;
			font-size: 14px;
			color: #686868;
			position: absolute;
			border: 1px solid;
		}
	</style>
</head>

<body>
	<div id="vue-root">
		<div class="refresh action-buttons" onclick="location.reload()">刷新</div>


		<select class="ui-select search" v-model="search.only"
			style="position: absolute; right: 524px; max-width: 120px;height: 33px;">
			<option :value="undefined">请选择是否有身份证信息</option>
			<option :value="true">有身份证信息</option>
			<option :value="false">无身份证信息</option>
		</select>

		<select class="ui-select search" v-model="search.similarity"
			style="position: absolute; right: 386px; max-width: 120px;height: 33px;">
			<option :value="undefined">请选择相似度</option>
			<option :value="40">≥40%</option>
			<option :value="75">≥75%</option>
			<option :value="85">≥80%</option>
		</select>

		<select class="ui-select search" v-model="search.deviceId"
			style="position: absolute; right: 248px; max-width: 120px;height: 33px;">
			<option :value="undefined">请选择考勤机</option>
			<option v-for="device in devices" :key="device.id" :value="device.id" v-text="device.name">
			</option>
		</select>

		<input placeholder="开始时间" class="other" v-model="search.startTime" id="startTime"
			style="width: 65px;height:33px;font-size:12px;position: absolute; right: 160px;padding-left: 5px;">
		<input placeholder="结束时间" class="other" v-model="search.endTime" id="endTime"
			style="width: 65px;height:33px;font-size:12px;position: absolute; right: 90px;padding-left: 5px;border-left: none;">
		<img src="../image/search.png" height="35" width="35" class="search_img" @click="getData0">
		<div class="table">
			<table class="table_top">
				<thead>
					<tr>
						<th class="one">
							<input type="checkbox" class="check-box" v-model="all">序号
						</th>
						<th>姓名</th>
						<th>性别</th>
						<th>考勤机</th>
						<th>省份</th>
						<th>城市</th>
						<th>身份证号</th>
						<th>时间</th>
						<th>拍照</th>
						<th>相似率</th>
						<th>体温</th>
						<!-- <th>被访人</th>
						<th>访问状态</th> -->
						<th v-if="able.del">删除</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(guest,index) in list" :key="guest.id">
						<td class="one">
							<input type="checkbox" class="check-box" v-model="guest.checked">
							<span v-text="index+1"></span>
						</td>
						<td>
							<span v-if="guest.idCard" v-text="guest.idCard.name"></span>
						</td>
						<td>
							<span v-if="guest.idCard" v-text="guest.idCard.sex"></span>
						</td>
						<td v-text="guest.deviceName"></td>
						<td>
							<span v-if="guest.idCard" v-text="guest.idCard.province"></span>
						</td>
						<td>
							<span v-if="guest.idCard" v-text="guest.idCard.city"></span>
						</td>
						<td>
							<span v-if="guest.idCard" v-text="guest.idCard.IDNo"></span>
						</td>
						<td v-text="format(guest.time)"></td>
						<td class="two photo">
							<img v-for="pic in pics(guest.pic)" :src="getImg(pic)" alt="" @click="bigImg(pic)">
						</td>
						<td>
							<span v-if="guest.idCard&&guest.idCard.similarity"
								v-text="guest.idCard.similarity+'%'"></span>
						</td>
						<td v-text="guest.temperature"></td>
						<!-- <td>刘老师</td>
						<td>访问拒绝</td> -->
						<td v-if="able.del">
							<img class="img" src="../image/delete.png" height="20" width="20"
								onmouseover="this.src='../image/delete_light.png'"
								onmouseout="this.src='../image/delete.png'" @click="del([guest.id])">
						</td>
					</tr>

				</tbody>
			</table>
		</div>
		<br>
		<div class="delete" @click="batchDelete" v-if="able.del">批量删除</div>
		<div class="delete long-background-img" @click="exports">导出访客记录</div>
		<ul class="pagination" v-if="pages>1">
			<li>
				<a v-if="pageNum!=1" @click="pageNum=1">«</a>
				<a class="pages-jump" v-if="pageNum!=1" @click="pageNum--">‹</a>
				<a v-text="pageNum"></a>
				<a class="pages-jump" v-if="pageNum!=pages" @click="pageNum++">›</a>
				<a v-if="pageNum!=pages" @click="pageNum=pages">»</a>
			</li>
		</ul>
		<div v-if="bigimg" @click="bigimg=false">
			<div class="img_layer"></div>
			<img :src="big_src" class="big_Img">
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/scriptZIP/dayjs.min.js"></script>

	<script src="/scriptZIP/dayjs.min.js"></script>


	<script src="/lib/laydate/laydate.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/auth_util.js"></script>

	<script>

		var schoolId = top_params().id;
		var app = new Vue(merge({
			data: {
				devices: [],
				classess: [],
				urls: {
					del: '/pc/guest/del'
				}
			},
			created: function () {
				axios.get('/pc/device/all/' + schoolId).then(function (res) {
					this.devices = res.data;
				}.bind(this));
				this.urls.list = '/pc/guest/list/' + schoolId;
				this.getData();
				abled('guest', this);
			},
			methods: {
				format: function (time) {
					if (!time) return null;
					return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
				},
				getImg: function (pic) {
					if (!pic) return null;
					return '/static/' + schoolId + '/attendance/' + pic;
				},
				bigImg: function (pic) {
					this.big_src = this.getImg(pic);
					this.bigimg = true;
				},
				pics: function (pics) {
					if (!pics) return [];
					return pics.split(',');
				},
				exports: function () {
					var q = Qs.stringify(this.search);
					if (q) q = '?' + q;
					location.href = '/pc/guest/export/' + schoolId + q;
				},
			},

		}));


		laydate.render({
			elem: '#startTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.startTime = value;
			}
		});

		laydate.render({
			elem: '#endTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.endTime = value;
			}
		});

	</script>

</body>

</html>